<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>喜来乐后台系统</title>
  <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
  <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
  <script src="js/jquery-3.6.0.min.js"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
  <style>
    .dv01{
      margin-top:10%;
    }
    .dv02{
      margin-top:5%;
    }
    .dv03{
      margin-top:3%;
    }
  </style>
</head>
<body style="background-color: beige;">

<div class="container">
  <div class="row dv01">
    <div class="col-sm-offset-4 col-sm-4">
      <h1>欢迎来到喜来乐美女库</h1>
    </div>
  </div>
  <div class="row dv02 clearfix">
    <div class="col-md-6 column">
      <img alt="140x140" src="../img/z4.jpg" style="width:100%" />
    </div>
    <div class="col-md-6 column">
      <form class="form-horizontal" style="margin-top:20%" role="form" id="fm1">
        <div class="form-group">
          <label for="ip1" class="col-sm-2 control-label">账号：</label>
          <div class="col-sm-10">
            <input type="text" class="form-control" name="name" id="ip1" placeholder="请输入账号" />
          </div>
        </div>
        <div class="form-group">
          <label for="ip2" class="col-sm-2 control-label">密码：</label>
          <div class="col-sm-10">
            <input type="password" class="form-control" name="password" id="ip2" placeholder="请输入密码" />
          </div>
        </div>
        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-10">
            <div class="checkbox">
              <label><input type="checkbox" />记住账号</label>
            </div>
          </div>
        </div>
        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-10">
            <button type="button" id="btn1" style="width:100%" class="btn btn-default">登陆</button>
          </div>

        </div>
        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-5">
            还没账号，<a href="register.html">点击注册新账号</a>
          </div>
          <div class="col-sm-5" style="text-align:right">
            忘记密码，<a href="findpass.html">点击找回密码</a>
          </div>
        </div>
      </form>
    </div>
  </div>
  <div class="row clearfix dv03">
    <div class="col-md-12 column">
      <div>©喜来乐相亲网 豫ICP证110507号 豫ICP备10046444号 豫公网安备11010802020134号 豫网文[2022]0059-0009号</div>
    </div>
  </div>
</div>
<script>
  $(function(){
      //绑定按钮的点击事件
      $("#btn1").click(function(){
        //ajax请求后端接口
        $.post("/api/user/login",$("#fm1").serialize(),function(res){
            if(res==200){
              //登陆成功
              location.href="index.html";
            }else{
              alert("亲，账号或密码错误，请检查！");
            }
        })
      })
  });
</script>
</body>
</html>